package com.cms.web.servlet;

import com.cms.pojo.Admin;
import com.cms.pojo.Sc;
import com.cms.service.CourseService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/deleteCourseServlet")
public class DeleteCourseServlet extends HttpServlet {
    private CourseService courseService = new CourseService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 课程id
        int id = Integer.parseInt(request.getParameter("id"));

        // 调用CourseService
        courseService.deleteCourse(id);

        request.getRequestDispatcher("/allCourseServlet").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
